package 力扣.链表;

import java.util.List;

public class 反转链表206 {
    public static void main(String[] args) {

    }
    //头插：使用假头
    public static ListNode reverseList(ListNode head) {
        ListNode dummy = new ListNode();
        while (head != null){
            ListNode tmp = head.next;
            head.next = dummy.next;
            dummy.next = head;
            head = tmp;//重新赋值，对原来的不造成影响，head.next 会造成影响
        }
        return dummy.next;
    }
}
